package com.lin.test.modle;

import java.util.Properties;

/**
 * Created by 林云志 on 2018/9/19.
 */
public class SimpleFactory {
    public static Weapon getWeapon(){
        try {
            Properties pro = new Properties();
            pro.load(SimpleFactory.class.getClassLoader().getResourceAsStream("beans.properties"));
            String w = (String) pro.get("weapon");
            Weapon weapon = (Weapon) Class.forName(w).newInstance();
            return weapon;


        }catch (Exception e){

        }

        return null;
    }
}
